﻿/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

using System;
using System.Runtime.CompilerServices;

namespace Gk3dEngine
{
    /*
     * Base class for all script
     * 
     */
    public enum ComponentType
    {
        COMPONENT_TRANSFORM=0,
        //insert component type here:
        COMPONENT_LIGHT,
        COMPONENT_MESH,
        COMPONENT_SCRIPT,
        COMPONENT_COUNT = COMPONENT_SCRIPT - COMPONENT_TRANSFORM + 1
    }

    public class Component : Object
    {
        private GameObject _gameObject;

        public GameObject GameObject
        {
            set { _gameObject = value; }
            get { return _gameObject; }
        }

        public virtual void init()
        {
        }

        public virtual void physicsUpdate()
        {
        }

        //must create new component before attach
        public void attach(GameObject obj)
        {
            _gameObject = obj;
            _gameObject.addComponent(this);
        }


        internal virtual void update(uint deltaT)
        {
            
        }
    }
}
